#include <IBean.h>
#include <ICamera.h>
#include "ILCMServlet.h"
#include "IServlet.h"
#include "ILogger.h"
#include "IContainer.h"
class LCMServletImp : public ILCMServlet{
public:
 
    virtual void open(ISession* session){
       // qcarcam_test_start();
       // Bean<ICamera>("qcarcam")->start();
       LogI("invoke Bean<ICamera>(\"qcarcam\")->start()");
    }
    virtual void close(ISession* session){
       // qcarcam_test_start();
       // Bean<ICamera>("qcarcam")->start();
       LogI("invoke Bean<ICamera>(\"qcarcam\")->start()");
    }
 
    virtual void onOpen(ISession* session) {
        LogI("onOpen %p",session);
        // Bean<ICamera>("qcarcam")->start();
        LogI("invoke Bean<ICamera>(\"qcarcam\")->start()");
        
    }
    virtual void onLoad(INode *node) {
        LogI("servlet onLoad");
    }
    virtual void onUnload() {
        LogI("servlet onUnload");
    }
};

class LCMServletImp4Test : public ILCMServlet4Test{
public:
    virtual void openCamera4Test(ISession* session,const int& x, const int& y){
       // qcarcam_test_start();
       // Bean<ICamera>("qcarcam")->start();
       LogI("invoke openCamera4Test x:%d y:%d",x,y);
    }
    virtual void openCamera4TestString(ISession *session, const int &x, const std::string &content) {
        LogI("invoke openCamera4TestString %d %s",x,content.c_str());

        session->Business<ICameraDiagServlet>()->stopCamera(session->getServlet());
    }
    virtual void openCamera4TestVector(ISession* session, const std::vector<std::string>& content)
    {
        for (auto i = content.begin(); i != content.end(); ++i) {
            LogI("recv:string %s",i->c_str());
        }
    }
};

REG_PLUGIN(LCMServletImp);
REG_PLUGIN(LCMServletImp4Test);
